const log4js = require('koa-log4')
const logger = log4js.getLogger('app')
// const fetch = require('node-fetch');
const fs=require('fs'); 
const path = require('path') 
exports.createRadomData = (param) => {
	logger.info('');
	var cabin_list = ['Y', 'M', 'B', 'V', 'Q', 'L'];
    var fare_list = [670, 550, 420, 310, 220, 140];
    var limit_list = [135, 129, 112, 98, 73, 40];
    var mean_list = [12, 17, 10, 22, 27, 47];
    var var_list = [7,8,6,9,10,14];
	var size = 1000;
	var data = [];
	for(var i = 0;i < param.size; i++){
		data.push(Math.floor(getNumberInNormalDistribution(param.height,param.error)))
	}
	return data; 
}

function getNumberInNormalDistribution(mean,std_dev){    
    return mean+(uniform2NormalDistribution()*std_dev);
}
function uniform2NormalDistribution(){
    var sum=0.0;
    for(var i=0; i<12; i++){
        sum=sum+Math.random();
    }
    return sum-6.0;
}